<script>
  var str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var a = Math.floor(Math.random() * (str.length - 1 - 0 + 1) + 0);
  var b = Math.floor(Math.random() * (str.length - 1 - 0 + 1) + 0);
  var c = Math.floor(Math.random() * (str.length - 1 - 0 + 1) + 0);
  var d = Math.floor(Math.random() * (str.length - 1 - 0 + 1) + 0);
  console.log("" + str[a] + str[b] + str[c] + str[d]);
</script>
